I have been recently accepted a lecturer position in a UK-based institution (which is supposed to be started in a couple of months). I had a discussion with my current postdoc supervisor (in a North American university) about applying grants in the UK (as they had worked in that system for a decade.) They just noted something about (STEM-based) PhD studentships in the UK that I don't truly digest. He said when a PI applies for a grant (associated with, e.g., UKRI), they has to declare any desired postdoc fellows as potential personnel that need to be recruited. So, their salaries have to be a part of the resource statement of the grant. But the PI should not state any required resources to recruit PhD students. Instead, once the grant is approved, the PI has to deal with their department so that the department provides them some PhD studentship. Is it really the case in that PhD students in the UK are funded by their departments not their PI's grants?
The information from your advisor is mostly true.
Postdoc salary and other costs come from external funding. UKRI is one source. Other sources such as charity funding and EU funding also work this way (at time of writing!).
For PhD students, UKRI explicitly do not allow costs for PhD students. These instead are usually funded through department budgets. There is a block PhD training grant provided to each university to cover some funding in this case. This is typically quite limited. Often funding for PhD students is negotiated with Head of Department (or other budget holder). This can be for example as part of a recruitment incentive or conditional to support other large grants.
UKRI provides most of its PhD funding through dedicated Centres for Doctoral Training. These are specialist institutes focussed on one area. If you are lucky to have one of these in your area at your institution, these can be a good source of high quality PhD students (although this can be quite competitive internally).
Charity funding and EU funding sometimes allow funding for PhD students.
The other route for funding PhD students is by them brining their own funding. I know of several students from Saudi Arabia and Mexico in our department who have brought this type of funding from their own governments.
In your case I would make contact with your new institution who will be able to give more specific advice on all these points.
In general you cannot fund students from normal research grants from UKRI (although there are some calls that are exempt from this rule).
Also, most departments don't fund students these days either (perhaps occasionally as part of a start up package, or a capacity building exercise in a new field).
The standard way for students to be funded (if they are funded), is through large grants specifically targeted at student education. At UKRI such calls are generally known as Doctoral Training Centres (DTC) or Programs (DTPs) or Collaborative Training Programs (CTPs). These grants will be judged not on the proposed research (no research is proposed at this stage), but the quantity of the training/education being offered and are usually collaborations between several universities that will fund 30 or so studentships a year. You will then have the oppotunity to apply to a DTP/C that your department is a part of. This is the stage at which the research you are proposing the student do will be assessed. You will probably be in competition with PIs from several universities. Students might apply directly to you, or to the program, and who makes the decisions about students varies from DTP to DTP.
The reasons for this are that in the UK, the people that make the decisions about such things regard students as students, not as researchers. While they do do research, they are their to get an education, not perform useful research. If the government wants research done (and done properly) it will pay for qualified researchers to be hired. If it wants to up-skill the workforce it will pay for education. These are two separate goals.
This is also partly connected to the fact that UK PhDs are only 4 years max (and are often only funded 3-3.5), but unlike Europe, where they also have time limited PhDs, students in the UK are not expected to have done a 2 year masters degree, so often have to go from zero to qualified researcher in a very short period of time.
Disclaimer: As I always point out on these threads, i'm not in favour of this system, just describing how it is, and the reasoning of those in charge.