Astrophysicists were beginning to calculate the future evolution of stars at least as early as the early 1960s.
Stephen H. Dole, in Habitable Planets for Man, 1964, discussed the qualities necessary for a world to be habitable for humans.
For example, a world has to have an atmosphere with a partial pressure of between 60 and 400 mmHg of oxygen to be breathable for humans. On pages 61 to 63 Dole discusses how long it co took Earth from its initial formation to acquire an atmosphere with enough free oxygen, produced by photosynthetic lifeforms. The present day answer is about 4 billion years, meaning that Earth has been habitable for humans for only about 600 million years.
Dole concludes that: "In general, it is probably safe to conclude that a planet must have existed for 2 or 3 billion years, under fairly steady conditions of solar radiation, before it has matured enough to be habitable."
On pages 67 to 72 Dole discusses the properties of the primary. Dole says that stars shine fairly steady on the main sequence until their available hydrogen is mostly used up, then swell into red giants, destroying life on any previously habitable planets, and then shrink to white dwarfs, perhaps having become novas during the process. More massive stars use up their hydrogen quicker and remain on the main sequence for shorter times.
Stars potentially capable of having habitable planets belong to spectral classes F, G, and K, in order of decreasing mass and luminosity. Spectral classes are further subdivided with numbers from 0 to 9 in order of decreasing mass and luminosity. Roman numerals are used to describe whether the stars are main sequence stars - V means main sequence.
According to the information available to Dole at the time of writing, stars with mass equal to or less than 1.4 solar masses and spectral types of F2V or colder, would remain on the main sequence for at least the minimum time of 3 billion years Dole considered necessary for a planet to become habitable.
Low mass dim stars have their circumstellar habitable zones (which Dole called "ecospheres"), where planets are expected to have the right temperatures for liquid water using life forms, so close to them that planets in them would become tidally locked, which Dole considered incompatible with habitability. Dole calculated that the inner part of the "ecosphere" of a star would be too close starting with a mass of 0.88 Sun and the whole ecosphere would be to close to the star starting with a mass of 0.72 Sun, a K1V class star.
So any science fiction writer who read Habitable Planets for Man in 1964 or later would realize that stars of type F2V to K1V were the only classes of stars likely to have planets with atmospheres breathable for humans. And if they wanted their stories to seem scientifically plausible to their more scientifically educated readers they would restrict depicting human habitable planets to those orbiting stars of spectral types F2V to K1V.
Jack Vance's five "Demon Princes" novels were published from 1964 to 1981.
In the first two, the protagonist makes his base on a human colony on a planet of the star Rigel, Beta Orionis, a B8 I supergiant. In the later books the protagonist makes his base of operations on a human colony planet orbiting the star Vega, Alpha Lyrae, an A0V class star. Neither Rigel nor Vega can last on the main sequence long enough for a planet to naturally become habitable for humans, though the problem is many times worse for Rigel than for Vega.
And I think I remember a quote in one of the "Demon Princes" books where it is stated that it is a scientific mystery how Rigel can have habitable planets, and terraforming by an ancient advanced civilization is suggested.
In this story identification question,
"Demon Flute" Story in Analog
I asked about a story which was identified in an answer as "Music Hath Charms", by Timothy Zahn, in Analog, April, 1985. In that story there are at least four stars known to have habitable planets; the star of the human colony planet that is the setting, Earth's star The Sun, Vega, and Algol, the "Demon Star".
And I wrote a letter to Stanley Schmidt, editor of Analog, pointing out that two of the four stars in the story with habitable planets, Vega and Algol, should not have habitable planets. As I remember, Schmidt wrote back, and didn't seem to consider stories with stars of the wrong spectral class to have habitable planets to be a problem.
And sometime later, I read an article by Schmidt with advice for science writers, including not to use stars of the wrong spectral classes to have habitable planets, and using Vega as an example of a class of star not to use.
So I guess than in the years since 1964 the more scientifically literate science fiction writers have gradually come to abandon putting habitable planets in orbit around stars of the wrong spectral classes to have habitable planets.
And avoiding stars more massive and luminous than main sequence class F stars is due to knowing that those more massive stars will become red giants too soon to have habitable planets.
And the earliest examples I can think of putting habitable worlds around only stars of the correct spectral classes may date to the 1950s in juvenile science fiction novels.
Robert A. Heinlein's Starman Jones (1954) and Time for the Stars both have statements that spectral class G stars are the most likely to have habitable planets. So possibly the future evolution of various types of stars had already been calculated by astrophysicists by the time Heinlein wrote those novels.